<template>
  <el-container id="main" >
      <leftVue :mode="mode"></leftVue>
    <el-container>
    <el-header>
        <el-dropdown>
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>查看</el-dropdown-item>
          <el-dropdown-item>新增</el-dropdown-item>
          <el-dropdown-item>删除</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span>王小虎</span>
    </el-header>
    <el-main class="admin-main" >
        <router-view></router-view>
    </el-main>
  </el-container>
  </el-container>
</template>

<script>
import leftVue from "@/components/left.vue";
import {mapGetters, mapActions} from "vuex"
export default {
  name: "admin",
  computed: mapGetters(['user']),
  data() {
    const item = {
      date: "2016-05-02",
      name: "王小虎",
      address: "上海市普陀区金沙江路 1518 弄"
    };
    return {
        mode: false,
      tableData: Array(20).fill(item)
    };
  },
  async mounted(){
    let sess = await this.session()
    if(!sess){
      this.$router.push("/login");
    }
  },
  methods: {
    ...mapActions(["session"])
  },
  components: {
    leftVue
  }
};
</script>

<style scoped>
#main {
  height: 100%;
}
.admin-main {
  -moz-box-shadow: 5px 5px 5px #eee inset; /* For Firefox3.6+ */
  -webkit-box-shadow: 5px 5px 5px #eee inset; /* For Chrome5+, Safari5+ */
  box-shadow: 5px 5px 5px #eee inset; /* For Latest Opera */
}
.el-header {
  background-color: RGB(71, 120, 199);
  color: #333;
  line-height: 60px;
}
</style>
